package p270jp.pxv.android.activity;

import android.net.Uri;
import android.os.Bundle;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.Objects;
import p005a5.C0022b;
import p014ae.AbstractActivityC0112k2;
import p014ae.C0059c5;
import p014ae.C0124n;
import p014ae.C0125n6;
import p014ae.C0146r;
import p014ae.C0182x5;
import p018ai.PixivSettings;
import p090d0.C2518n;
import p154fd.CompletableAndThenCompletable;
import p154fd.CompletableObserveOn;
import p183gh.ABTestService;
import p210hh.PixivAccountManager;
import p258jd.SingleCreate;
import p258jd.SingleFlatMap;
import p261jg.PixivSchemeUriMatchService;
import p261jg.PixivSchemeUriNavigateService;
import p270jp.pxv.android.commonObjects.model.WorkType;
import p270jp.pxv.android.upload.IllustUploadActivity;
import p347mm.MailAuthorizationListener;
import p446qh.PpointPurchaseDomainService;
import p491sd.C6034a;
import p639y6.C7291g;
import p645yc.AndroidSchedulers;
import p665z6.C7461p;
import p671zc.CompositeDisposable;

/* renamed from: jp.pxv.android.activity.PixivSchemeFilterActivity */
/* loaded from: classes2.dex */
public class PixivSchemeFilterActivity extends AbstractActivityC0112k2 {

    /* renamed from: C */
    public static final /* synthetic */ int f18499C;

    /* renamed from: A */
    public PixivSchemeUriMatchService f18500A;

    /* renamed from: B */
    public PixivSettings f18501B;

    /* renamed from: v */
    public PpointPurchaseDomainService f18502v;

    /* renamed from: w */
    public final CompositeDisposable f18503w = (CompositeDisposable) C2518n.m7641d(CompositeDisposable.class);

    /* renamed from: x */
    public final PixivAccountManager f18504x = (PixivAccountManager) C2518n.m7641d(PixivAccountManager.class);

    /* renamed from: y */
    public final ABTestService f18505y = (ABTestService) C2518n.m7641d(ABTestService.class);

    /* renamed from: z */
    public PixivSchemeUriNavigateService f18506z;

    /* renamed from: jp.pxv.android.activity.PixivSchemeFilterActivity$a */
    /* loaded from: classes2.dex */
    public class C4055a implements MailAuthorizationListener {

        /* renamed from: a */
        public final /* synthetic */ Uri f18507a;

        public C4055a(Uri uri) {
            PixivSchemeFilterActivity.this = r1;
            this.f18507a = uri;
        }

        @Override // p347mm.MailAuthorizationListener
        /* renamed from: a */
        public void mo949a() {
        }

        @Override // p347mm.MailAuthorizationListener
        /* renamed from: b */
        public void mo948b() {
        }

        @Override // p347mm.MailAuthorizationListener
        /* renamed from: c */
        public void mo947c() {
            String queryParameter = this.f18507a.getQueryParameter("tag");
            PixivSchemeFilterActivity pixivSchemeFilterActivity = PixivSchemeFilterActivity.this;
            pixivSchemeFilterActivity.startActivity(IllustUploadActivity.f19355K.m4539a(pixivSchemeFilterActivity, WorkType.ILLUST, queryParameter));
        }

        @Override // p347mm.MailAuthorizationListener
        public void failure(Throwable th) {
        }
    }

    /* renamed from: S0 */
    public final Calendar m4776S0(String str) {
        Calendar instance = Calendar.getInstance();
        if (str != null) {
            try {
                instance.setTime(new Date(new SimpleDateFormat("yyyyMMdd", Locale.US).parse(str).getTime()));
            } catch (ParseException unused) {
                instance.add(5, -1);
            }
        } else {
            instance.add(5, -1);
        }
        return instance;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Removed duplicated region for block: B:109:0x01cf  */
    /* JADX WARN: Removed duplicated region for block: B:111:0x01ec  */
    /* renamed from: T0 */
    /* Code decompiled incorrectly, please refer to instructions dump */
    public final void m4775T0(android.net.Uri r25) {
        /*
        // Method dump skipped, instructions count: 1492
        */
        throw new UnsupportedOperationException("Method not decompiled: p270jp.pxv.android.activity.PixivSchemeFilterActivity.m4775T0(android.net.Uri):void");
    }

    @Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f18502v = (PpointPurchaseDomainService) C2518n.m7640e(PpointPurchaseDomainService.class, null, new C0125n6(C0022b.m12183x(this), 0));
        this.f18506z = (PixivSchemeUriNavigateService) C2518n.m7641d(PixivSchemeUriNavigateService.class);
        this.f18500A = (PixivSchemeUriMatchService) C2518n.m7641d(PixivSchemeUriMatchService.class);
        Uri data = getIntent().getData();
        this.f18501B = (PixivSettings) C2518n.m7641d(PixivSettings.class);
        PixivAccountManager bVar = this.f18504x;
        if (!bVar.f16506l) {
            PixivSchemeUriMatchService aVar = this.f18500A;
            Objects.requireNonNull(aVar);
            this.f18503w.mo82c(new SingleFlatMap(new SingleCreate(new C7291g(data, aVar, 5)), new C7461p(this, 9)).m961o(C6034a.f26178c).m966j(AndroidSchedulers.m334a()).m963m(new C0146r(this, 1), C0182x5.f655c));
        } else if (bVar.f16505k) {
            this.f18503w.mo82c(new CompletableObserveOn(new CompletableAndThenCompletable(this.f18502v.m2784c(), this.f18502v.m2785b()).m1008i(C6034a.f26178c), AndroidSchedulers.m334a()).m1010g(new C0124n(this, data, 1), new C0059c5(this, data, 1)));
        } else {
            m4775T0(data);
        }
    }

    @Override // p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        super.onDestroy();
        this.f18503w.m80f();
        this.f18502v.m2783d();
    }
}
